import { Prefab } from "cc";
import Data from "../scripts/core/manager/Data";
import Utils from "../scripts/core/utils/Utils";

export let ItemNames = [
	"Anvil",
	"Apple",
	"Attach",
	"AttentionSign",
	"Axe",
	"BachelorHat",
	"Ball",
	"Banana",
	"BasketWood",
	"Beer",
	"BirdHouse",
	"Bomb",
	"book",
	"Book2",
	"Bottle",
	"Bow",
	"Box",
	"Broom",
	"Bulb",
	"Cactus",
	"Can",
	"Candle",
	"Chair",
	"Charger",
	"Number1",
	"Number2",
	"Number3",
	"Number4",
	"Number5",
	"Number6",
	"Number7",
	"Number8",
	"Number9",
	"Oak",
	"Onion",
	"Orange",
	"PaintRoller",
	"Pan",
	"PanFlute",
	"PaperPlane",
	"PaperShip",
	"Pawn",
	"PeaceSymbol",
	"Pen",
	"Pencil",
	"PencilSharpener",
	"PhotoMachine",
	"Piano",
	"Pie",
	"PilatesWeight",
	"PillBottle",
	"PotionBlue",
	"QuestionMark",
	"Rainbow",
	"RemoteControl",
	"Ring2",
	"Robot",
	"RockingHorse",
	"Roll",
	"RugbyBall",
	"SandGlass",
	"Sandwich",
	"SantaHat",
	"Sauce",
	"Saw",
	"Shield",
	"Sign",
	"SingleBarNote",
	"Skull",
	"Smartphones",
	"Sofa",
	"Spanner",
	"Sprite",
	"Star",
	"SwimRing",
	"Sword",
	"Table",
	"TextA",
	"TextB",
	"TextC",
	"TextD",
	"TextE",
	"TextF",
	"TextG",
	"TextH",
	"TextI",
	"TextJ",
	"TextK",
	"TextL",
	"TextM",
	"TextN",
	"TextO",
	"TextP",
	"TextQ",
	"TextR",
	"TextS",
	"TextT",
	"TextU",
	"TextV",
	"TextW",
	"TextX",
	"TextY",
	"TextZ",
	"Tissue",
	"Toaster",
	"ToGoCup",
	"ToolBox",
	"ToothPaste",
	"TreasureChest",
	"Turner",
	"Ufo",
	"Umbrella",
	"Watermelon",
	"Window",
	"Yam",
	"Yarn",
	"Yogurt",
	"YogurtWithGroin",
];

export let OpenItems = [
	"ChocolateBar",
	"ChocolatePie",
	"ClothesPeg",
	"CoffeeCup",
	"CoffeePot",
	"Coin",
	"CokeCup",
	"Comb2",
	"Compass",
	"Cone",
	"Cookie",
	"Creamer",
	"CrowBar",
	"Cutter",
	"CylinderHat",
	"DartArrow",
	"Desk",
	"Dice",
	"DonutCream",
	"Driver",
	"Egg",
	"Eightnote",
	"Energy",
	"EspressoCup",
	"ExclamationMark",
	"EyeGlasses",
	"Fan",
	"FanHat",
	"FirefighterHat",
	"Firework",
	"FirstAidBag",
	"Football",
	"FrenchPress",
	"FriedPotato",
	"GasCanister",
	"Gillette",
	"GoldBar",
	"GoldCoinBag1",
	"GoldCoinBag2",
	"Ham",
	"HandLamp",
	"HandMixer",
	"Hanger",
	"Hardal",
	"HardHat",
	"Harmonica",
	"Helmet",
	"HorseShoe",
	"HotDog",
	"House",
	"Ice",
	"IceCream",
	"IceCreamPink",
	"JamJar",
	"Jewel",
	"Jigsaw",
	"Juice",
	"King",
	"Kiwi",
	"Klaket",
	"Kleenex",
	"Lamp",
	"LandMine",
	"Leaf",
	"Lemon",
	"LesserPanda",
	"Letter",
	"LetterBox",
	"Lipstick",
	"Lock",
	"Log",
	"Magnet",
	"MagnifyingGlass",
	"MapPin",
	"Measuares",
	"Medal",
	"Megaphone",
	"MilkBox",
	"Monitor",
	"Mushroom",
	"Newspaper",
]


export let Levels =
	[{
		"levelId": 1, "rowCount": 3, "columnCount": 3, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 2, "rowCount": 6, "columnCount": 5, "levelTime": 300, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 3, "rowCount": 6, "columnCount": 7, "levelTime": 420, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 4, "rowCount": 6, "columnCount": 6, "levelTime": 360, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 5, "rowCount": 6, "columnCount": 6, "levelTime": 360, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 6, "rowCount": 6, "columnCount": 8, "levelTime": 720, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 7, "rowCount": 6, "columnCount": 9, "levelTime": 860, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 8, "rowCount": 6, "columnCount": 10, "levelTime": 600, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 9, "rowCount": 6, "columnCount": 10, "levelTime": 600, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 10, "rowCount": 6, "columnCount": 15, "levelTime": 1560, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 11, "rowCount": 8, "columnCount": 10, "levelTime": 960, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 12, "rowCount": 8, "columnCount": 10, "levelTime": 800, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 13, "rowCount": 8, "columnCount": 10, "levelTime": 960, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 14, "rowCount": 8, "columnCount": 10, "levelTime": 800, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 15, "rowCount": 8, "columnCount": 10, "levelTime": 800, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 16, "rowCount": 8, "columnCount": 10, "levelTime": 800, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 17, "rowCount": 8, "columnCount": 10, "levelTime": 800, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 18, "rowCount": 8, "columnCount": 10, "levelTime": 800, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 19, "rowCount": 8, "columnCount": 10, "levelTime": 800, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 20, "rowCount": 10, "columnCount": 12, "levelTime": 1700, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 21, "rowCount": 8, "columnCount": 10, "levelTime": 800, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 22, "rowCount": 10, "columnCount": 10, "levelTime": 1200, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 23, "rowCount": 8, "columnCount": 10, "levelTime": 800, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 24, "rowCount": 10, "columnCount": 10, "levelTime": 2040, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 25, "rowCount": 8, "columnCount": 10, "levelTime": 800, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 26, "rowCount": 10, "columnCount": 10, "levelTime": 1200, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 27, "rowCount": 8, "columnCount": 10, "levelTime": 800, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 28, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 29, "rowCount": 8, "columnCount": 10, "levelTime": 800, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 30, "rowCount": 10, "columnCount": 12, "levelTime": 1440, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 31, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 32, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 33, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 34, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 35, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 36, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 37, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 38, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 39, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 40, "rowCount": 10, "columnCount": 12, "levelTime": 1440, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 41, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 42, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 43, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 44, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 45, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 46, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 47, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 48, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}, {
		"levelId": 49, "rowCount": 10, "columnCount": 10, "levelTime": 1000, "itemScale": {
			"x": 1.25, "y": 1.25, "z": 1.25
		}
	}
	]

export let getCurLevelInfo = () => {
	let index = 0;
	let lv = Data.user.lv - 1;
	if (lv > Levels.length) {
		index = lv % (Levels.length - 10) + 10;
	}
	else {
		index = lv;
	}
	return Levels[index];
}


export function LoadItemPrefabByName(name: string) {
	if (["Anvil",
		"Apple",
		"Attach"].indexOf(name) != -1) {
		return Utils.loadRes(name, "item0", Prefab)
	}
	return Utils.loadRes(name, "item1", Prefab)
}

